package com.kang.filter;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;


@Component
public class MyGlobalFilter implements GlobalFilter, Ordered {

    /**
     * 验证token
     * redis中token是否过期
     * 过期 抛出
     * 没过期 每次访问刷新redis时间
     */
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {

        return chain.filter(exchange);
    }


    /**
     * 指定过滤器顺序的方法
     * @return
     */
    @Override
    public int getOrder() {
        return 0;
    }
}
